package edu.pku.sei.transformation.editor.model.execution;

import java.util.ArrayList;
import java.util.List;

import edu.pku.sei.transformation.editor.model.CopyTransformation;
import edu.pku.sei.transformation.editor.model.Transformation;
import edu.pku.sei.transformation.editor.model.TransformationFormalParameter;

public class CopyTransfroamtionExecution extends TransformationExecution {
	public CopyTransfroamtionExecution() {
		super.setTransformation(CopyTransformation.instance);
		super.setDirection(CopyTransformation.out);
		super.setExecutionMode(TransformationExecution.MODE_ENFORCE);
	}
	
	@Override
	public Object[] getDirectionCandidates() {
		return new Object[]{CopyTransformation.out};
	}
	
	/**
	 * can not set direction
	 */
	@Override
	public void setDirection(TransformationFormalParameter outputPara) {
		
	}
	
	@Override
	public Object[] getTransformations() {
		return new Object[]{CopyTransformation.instance};
	}
	
	/**
	 * can not set transformation
	 */
	@Override
	public void setTransformation(Transformation transformation) {
		return;
	}
	
	@Override
	public List<TransformationFormalParameter> getAvailiableFormalParameters(
			TransformationActualParameter p) {
		List<TransformationFormalParameter> parameters = new ArrayList<TransformationFormalParameter>();
		parameters.addAll(super.getTransformation().getModelParameter());

		for (Object ap : super.getActualParameters()) {
			if (ap != p)
				parameters.remove(((TransformationActualParameter) ap).getFormalParameter());
		}
		return parameters;
	}
	
	
}
